<div class="box-body">
    <form class="layui-form" action="{:url('/fac/invoice/save')}" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label xrequired">发票类型</label>
            <div class="layui-input-block">
                <select name="type" lay-search>
                    {foreach $invoice_type as $k=>$v}
                    <option {if isset($invoice) && $invoice->getData('type') == $k}selected{/if} value="{$k}">{$v}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">银行账户</label>
            <div class="layui-input-block">
                <select name="bank_id" lay-search>
                    <option value="">请选择</option>
                    {foreach $banks as $bank}
                    <option {if isset($invoice) && $invoice.bank_account == $bank.account}selected{/if} value="{$bank.bank_id}">{$bank.name_acc}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label xrequired">发票抬头</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="发票抬头"  name="title" {if isset($invoice)}value="{$invoice.title}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label xrequired">纳税号</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="纳税人识别号"  name="tax_code" {if isset($invoice)}value="{$invoice.tax_code}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">企业地址</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="企业地址"  name="address" {if isset($invoice)}value="{$invoice.address}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">电话</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="电话"  name="phone" {if isset($invoice)}value="{$invoice.phone}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="邮箱"  name="email" {if isset($invoice)}value="{$invoice.email}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-block">
                <input type="number" autocomplete="off" placeholder="排序"  name="sort" {if isset($invoice)}value="{$invoice.sort}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" placeholder="备注"  name="remark" {if isset($invoice)}value="{$invoice.remark}"{/if} class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="checkbox" name="status" value="1" {if !isset($invoice) || $invoice.status=='1'}checked{/if} lay-skin="switch">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">默认</label>
            <div class="layui-input-block">
                <input type="checkbox" name="is_default" value="1" {if isset($invoice) && $invoice.is_default=='1'}checked{/if} lay-skin="switch">
            </div>
        </div>
        {if isset($invoice)}
        <input type="hidden" name="invoice_id" value="{$invoice.invoice_id}">
        {/if}
    </form>
</div>